
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="comon.jsp"%>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="page-header">
                <h1>
                    <small>训练记录</small>
                </h1>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 column">
                <%--toAddMember--%>
                <a class="btn btn-primary" href="${pageContext.request.contextPath}/Record/toStartRecord">训练登记</a>
                <a class="btn btn-primary" href="${pageContext.request.contextPath}/Record/allRecord">查询训练记录</a>
            </div>
            <div class="col-md-8 column">
                <%--添加功能：搜索会员--%>
                <form class="form-inline" action="${pageContext.request.contextPath}/Record/queryRecord" method="post" style="float: right">
                    <span style="color: red;font-weight: bold">${error}</span>
                    <input type="text" value="" name="mId" class="form-control" placeholder="请输入要记录的会员id"/>
                    <input type="submit" class="btn btn-primary" value="搜索">
                </form>
            </div>

        </div>
        <div class="row clearfix">
            <div class="col-md-12 column">
                <table class="table table-hover table-striped table-bordered">
                    <thead>
                    <tr>
                        <th>会员id</th>
                        <th>健身开始时间</th>
                        <th>健身完毕时间</th>
                        <th>健身次数</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <%--
                    从数据库中查询出来，从这个list集合中遍历出来每一本member
                    每一本member中还有属性
                    --%>
                    <tbody>
                    <c:forEach var="record" items="${list}">
                        <tr>
                            <td>${record.mId}</td>
                            <td><fmt:formatDate value="${record.startTime}" pattern="yyyy年MM月dd日 HH:mm:ss"/></td>
                            <td><fmt:formatDate value="${record.overTime}" pattern="yyyy年MM月dd日 HH:mm:ss"/></td>
                            <td>${record.frequency}</td>
                            <td>
                                <a href="${pageContext.request.contextPath}/Record/overRecord?mId=${record.mId}&frequency=${record.frequency}" >结束训练</a>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <div id="main" style="width: 600px;height:400px;"></div>
    <script type="text/javascript">
        const chartDom = document.getElementById('main');
        const myChart = echarts.init(chartDom);
        let option;
        option = {
            title: {
                text: '健身房数据统计',
                left: 'center'
            },
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'shadow'
                }
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            xAxis: [
                {
                    type: 'category',
                    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
                    axisTick: {
                        alignWithLabel: true
                    }
                }
            ],
            yAxis: [
                {
                    type: 'value'
                }
            ],
            series: [
                {
                    name: 'Direct',
                    type: 'bar',
                    barWidth: '60%',
                    data: [${Mon}, ${Tue}, ${Wed}, ${Thu}, ${Fri}, ${Sat}, ${Sun}]
                }
            ]
        };

        option && myChart.setOption(option);
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    </script>

    </section>
    <script src="${pageContext.request.contextPath}/js/script.js"></script>
    </body>

    </html>